Coinductive subtyping for abstract compilation of object-oriented languages into Horn formulas
نویسندگان
چکیده
In recent work we have shown how it is possible to define very precise type systems for objectoriented languages by abstractly compiling a program into a Horn formula f . Then type inference amounts to resolving a certain goal w.r.t. the coinductive (that is, the greatest) Herbrand model of f . Type systems defined in this way are idealized, since in the most interesting instantiations both the terms of the coinductive Herbrand universe and goal derivations cannot be finitely represented. However, sound and quite expressive approximations can be implemented by considering only regular terms and derivations. In doing so, it is essential to introduce a proper subtyping relation formalizing the notion of approximation between types. In this paper we study a subtyping relation on coinductive terms built on union and object type constructors. We define an interpretation of types as set of values induced by a quite intuitive relation of membership of values to types, and prove that the definition of subtyping is sound w.r.t. subset inclusion between type interpretations. The proof of soundness has allowed us to simplify the notion of contractive derivation and to discover that the previously given definition of subtyping did not cover all possible representations of the empty type.
منابع مشابه
On sound and complete axiomatization of coinductive subtyping for object-oriented languages
Coinductive abstract compilation is a novel technique, which has been recently introduced for defining precise type systems for objectoriented languages. In this approach, type inference consists in translating the program to be analyzed into a Horn formula f , and in resolving a certain goal w.r.t. the coinductive (that is, the greatest) Herbrand model of f . Type systems defined in this way a...
متن کاملAbstract compilation of object-oriented languages into coinductive CLP(X): when type inference meets verification
compilation of object-oriented languages into coinductive CLP(X): when type inference meets verification Davide Ancona, Andrea Corradi, Giovanni Lagorio, and Ferruccio Damiani 1 DISI, University of Genova, Italy {davide,lagorio}@disi.unige.it,[email protected] 2 Dipartimento di Informatica, University of Torino, Italy
متن کاملType systems for object-oriented languages based on coinductive logic
We propose a novel approach based on coinductive logic to specify type systems of programming languages. The approach consists in encoding programs in Horn formulas which are interpreted w.r.t. their coinductive Herbrand model. We illustrate the approach by first specifying a standard type system for a small object-oriented language similar to Featherweight Java. Then we define an idealized typ...
متن کاملSemantic subtyping between coinductive mutable record types with unions and intersections
Semantic subtyping between coinductive record types supports accurate type analysis of object-oriented languages, by introducing Boolean type constructors and modeling cyclic objects. In previous work, a sound and complete algorithm for semantic subtyping has been proposed, but only for coinductive immutable record types with unions. In this work we address the issue of extending the previous r...
متن کاملType Inference by Coinductive Logic Programming
We propose a novel approach to constraint-based type inference based on coinductive logic. Constraint generation corresponds to translation into a conjunction of Horn clauses P , and constraint satisfaction is defined in terms of the coinductive Herbrand model of P . We illustrate the approach by formally defining this translation for a small object-oriented language similar to Featherweight Ja...
متن کامل